package com.ayf.payment.game.api.task.reissue;

import com.swwx.charm.zookeeper.exception.GetLockFailedException;
import com.swwx.charm.zookeeper.lock.DistributedLock;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.task.TaskExecutor;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @author wwl
 * @description:
 * @date 2020/10/28 21:25
 */
@Component
public class ReissueRecordTask extends ReissueRecordResultTask{

    @Autowired
    protected DistributedLock distributedLock;

    @Autowired
    protected TaskExecutor reissueRecordTaskExecutor;

    @Scheduled(cron = "0/20 * * * * ?")
    public void run() throws GetLockFailedException {
        super.run(distributedLock);
    }

    @Override
    public void submit(Runnable task) {
        reissueRecordTaskExecutor.execute(task);
    }
}
